﻿using GameEntitySystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NekoMeko
{
	public class SubsystemNekoPlayerData : Subsystem
	{//玩家重生后恢复模型皮肤数据
		readonly Dictionary<int, KeyValuePair<string, string>> m_data = [];

		public void SetData(int playerIndex, string modelKey, string skinKey)
		{
			if (playerIndex < 0)
				return;
			GetData(playerIndex, out string modelKey2, out string skinKey2);
			if (string.IsNullOrEmpty(modelKey))
				modelKey = modelKey2;
			if(string.IsNullOrEmpty(skinKey))
				skinKey = skinKey2;
			m_data[playerIndex] = new KeyValuePair<string, string>(modelKey, skinKey);
		}

		public void GetData(int playerIndex, out string modelKey, out string skinKey)
		{
			modelKey = string.Empty;
			skinKey = string.Empty;
			if (m_data.TryGetValue(playerIndex, out var keyValuePair))
			{
				modelKey = keyValuePair.Key;
				skinKey = keyValuePair.Value;
			}
		}
	}
}
